Skip to content

[kotlin][KTOR] remove unnecessary dependencies #13640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Marek00Malik
Copy link
Contributor

@Marek00Malik Marek00Malik commented Oct 7, 2022

Fix that addresses the issue discussed in PR nr #12966. Adding missing ContentType header with JSON value.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request. [@jimmidyson @dr4ke616 @karismann @Zomzog @andrew-matteson @4brunu @yutaka0m ]

6.1.0-SNAPSHOT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR.

looks like you're not using the latest master, can you please merge the latest master into your branch and regenerate the samples?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated, but I have a problem with generating samples.
It's failing on kotlin-default-values-*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I figured out what's the problem with the generator. I was running on Java 17 which failed to build the generator.
Maybe it would be helpful to have it scripted or have this in a container with all JVM stuff preset.
Anyways. pushed the new samples with the right version :)

@@ -199,8 +201,10 @@ import {{packageName}}.auth.*
}
this.method = requestConfig.method.httpMethod
headers.filter { header -> !UNSAFE_HEADERS.contains(header.key) }.forEach { header -> this.header(header.key, header.value) }
if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH))
if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH)) {
contentType(Json)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to say that "application/json" becomes the default content type if it's not specified in the spec (e.g. 2.0) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I checked the source code and in fact both serializers (gson and jackson) set json as the default content type.
I reverted the changes only leaving the fix to ktor client. There were imports that no longer present and the nullable property that was already fixed in the multiplatform version.

@Marek00Malik Marek00Malik force-pushed the fix/update-kotlin-multiplatform branch from a46b82f to 18f1eef Compare October 11, 2022 20:04
@Marek00Malik Marek00Malik force-pushed the fix/update-kotlin-multiplatform branch from 18f1eef to 6dcd731 Compare October 11, 2022 20:50
@Marek00Malik
Copy link
Contributor Author

@wing328 can we merge this PR?
We would love to start using Ktor clients within our Ktor projects and not add additional unnecessary dependencies.

@wing328
Copy link
Member

wing328 commented Oct 18, 2022

@Marek00Malik
Copy link
Contributor Author

@Marek00Malik can you please take a look at the error in https://github.com/OpenAPITools/openapi-generator/actions/runs/3244612257/jobs/5321013628 ?

Hey @wing328. Samples fixed

@wing328 wing328 changed the title Add Explicite ContentType Header with JSON value to KTOR clients [kotlin][KTOR] remove unnecessary dependencies Oct 18, 2022
@wing328 wing328 merged commit 3f4e3af into OpenAPITools:master Oct 18, 2022
@Marek00Malik Marek00Malik deleted the fix/update-kotlin-multiplatform branch November 16, 2022 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants